LOCAL_PATH:= $(call my-dir)/hello

include $(CLEAR_VARS)

OBJ_MODULE_NAME = my_hello.ko

LOCAL_MODULE_TAGS := optional
LOCAL_MODULE := $(OBJ_MODULE_NAME)
LOCAL_MODULE_CLASS := SHARED_LIBRARIES
LOCAL_MODULE_PATH := $(PRODUCT_OUT)/root/lib/modules
LOCAL_STRIP_MODULE := keep_symbols
LOCAL_SRC_FILES := $(LOCAL_MODULE)
include $(BUILD_PREBUILT)

ifeq ($(TARGET_BUILD_VARIANT),user)
DEBUGMODE := BUILD=no
else
DEBUGMODE := $(DEBUGMODE)
endif


$(LOCAL_PATH)/$(OBJ_MODULE_NAME): $(TARGET_PREBUILT_KERNEL)
	$(MAKE) -C $(shell dirname $@) ARCH=$(TARGET_KERNEL_ARCH) CROSS_COMPILE=$(KERNEL_CROSS_COMPILE) $(DEBUGMODE) KDIR=$(ANDROID_PRODUCT_OUT)/obj/KERNEL clean
	$(MAKE) -C $(shell dirname $@) ARCH=$(TARGET_KERNEL_ARCH) CROSS_COMPILE=$(KERNEL_CROSS_COMPILE) $(DEBUGMODE) KDIR=$(ANDROID_PRODUCT_OUT)/obj/KERNEL
	$(TARGET_STRIP) -d --strip-unneeded $@
